package com.cet.designpatterns.responsibilitychain;

import java.math.BigDecimal;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-09-29 10:39
 **/
public class VicePresidentApprover extends Approver {

    public VicePresidentApprover(String name) {
        super(name);
    }

    @Override
    public void processRequest(PurchaseRequest request) {
        if (request.getPrice().compareTo(new BigDecimal("10000")) > 0
                && request.getPrice().compareTo(new BigDecimal("30000")) <= 0) {
            System.out.println("请求编号 id=" + request.getId() + "，被" + this.name + "处理");
        } else {
            next.processRequest(request);
        }
    }
}
